package com.demo.crud.aop;

import com.demo.crud.exception.NotRepeatSubmitException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created with IntelliJ IDEA.
 * Desc:
 *
 * @author: keen
 * Date: 2019-06-09
 * Time: 11:49
 */
@RestControllerAdvice
public class ExceptionHandler {
    @ResponseStatus(HttpStatus.BAD_REQUEST)
    @org.springframework.web.bind.annotation.ExceptionHandler(NotRepeatSubmitException.class)
    public String repeatExceptionHandler(NotRepeatSubmitException e) {
        return e.toString();
    }
}
